package com.hsj.feign.controller;

import com.hsj.feign.service.FeignService;
import dto.Reponse;
import dto.TransData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import pojo.User;

/**
 * @author:Teacher黄
 * @date:Created at 2020/01/01
 */
@RestController
public class FeignController {


    @Autowired
    private FeignService feignService;

    @GetMapping("/feign/hello")
    public TransData hello(){
        String hello = feignService.hello();
        return Reponse.ok("success",hello);
    }
    @GetMapping("/feign/get/{userName}")
    public TransData getData(@PathVariable String userName){
        return feignService.getData(userName);
    }
    @PostMapping("/feign/post")
    public TransData postData( String userName){
        return feignService.postData(userName);
    }

    @PostMapping("/feign/user")
    public TransData postUser(@RequestBody User user){
        System.out.println(user);
        return feignService.postUser(user);
    }
}
